<?php
// phpinfo();die;
// $dbh = new PDO("mysql:host=127.0.0.1;dbname=ceshi;port=3306", 'root', 'root');
// die();
$dbName = "sqlsrv:server=hj34414161.oicp.vip,33766;database=test";
$dbUser = "sa";
$dbPassword = "123456";
    $db = new PDO($dbName, $dbUser, $dbPassword);
    if($db) {
    echo "连接成功";
    }else{
    echo "连接失败";
    }
    die('1');
// }
// catch(PDOException $e) {
//     $content = $e->getMessage();
//     echo $content;
// }
$sql = "SELECT * FROM dbo.品种";
$res = $db->query($sql);
while ($row = $res->fetch()){
    print_r($row);
}
?>